home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4469 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  47 lines

  1. Newsgroups: comp.lang.c
  2. Path: lyra.csx.cam.ac.uk!warwick!bsmail!talisker!nathan
  3. From: nathan@pact.srf.ac.uk (Nathan Sidwell)
  4. Subject: Re: Can main() function be called?
  5. Message-ID: <DMAtsL.GwE@uns.bris.ac.uk>
  6. Sender: usenet@uns.bris.ac.uk (Usenet news owner)
  7. Nntp-Posting-Host: talisker.pact.srf.ac.uk
  8. Organization: Inmos
  9. X-Newsreader: TIN [version 1.2 PL2]
  10. References: <4f3hgv$ml8@columba.udac.uu.se>
  11. Date: Mon, 5 Feb 1996 10:43:32 GMT
  12.  
  13. Fredrik Raadesand (m92fra@sabik.tdb.uu.se) wrote:
  14. : > I think that it cannot be done, I see no reasonalbe way how main()
  15. : > could be called more than once.
  16. Yes, there's nothing especially magic about main. The special thing is
  17. that somewhere in the c startup there's a call to it. It's the only
  18. user defined function which the C startup calls without being
  19. told to by the user program.
  20.  
  21. : I would say the simplest way to find out is to try it out ?
  22. : ...to post the question on the net is probably more difficult. ;)
  23.  
  24. : Either it works or it doesn't, right ?
  25. This is a dangerous fallacy. Your particular implementation does
  26. not define the standard. In the abcense of knowledge of the standard,
  27. it is impossible to tell whether what happens, is because
  28.     a)the standard said so
  29.     b)the standard said it's implementation defined
  30.     c)the standard said it's undefined.
  31. b & c are different. B requires an implementation to define what happens
  32. C means the implementation can do anything, and it can do different things
  33. each time.
  34.  
  35. examples are (a, b & c are ints)
  36.     a) a = 1;
  37.     b) b = -5 / 2; /* result -2 or -3 */
  38.     c) c = c++; /* undefined, modified twice between sequence points */
  39.  
  40. nathan
  41.  
  42. --
  43. Nathan Sidwell                         Holder of the Xmris home page
  44. Chameleon Architecture Group at SGS-Thomson, formerly Inmos
  45. http://www.pact.srf.ac.uk/~nathan/                  Tel 0117 9707182
  46. nathan@inmos.co.uk or nathan@bristol.st.com or nathan@pact.srf.ac.uk
  47.